<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/jquery.min.js"></script>
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/api.js"></script>
    <style type="text/css">
        .header {
            padding: 2.5rem 0.5rem 2rem 0.5rem;
        }
    </style>
</head>

<body>
    <header class="aui-bar aui-bar-nav" style="padding-top:25px;">
        <!-- <a class="aui-pull-left aui-btn" onclick="closeWin()">
        <span class="aui-iconfont aui-icon-left"></span>
    </a> -->
        <div class="aui-title">E文通</div>
        <a class="aui-pull-right aui-btn"></a>
    </header>
<div class="head-d"></div>
    <div class="user-t">
        <img src="./image/gril.jpg" id="headImg">

        <p>部门：
            <p1 id="p1">
                <p1>
        </p>
        <p>职位：
            <p1 id="p2">
                <p1>
        </p>
        <p>名字：
            <p1 id="p3">
                <p1>
        </p>

    </div>

    <div class="aui-content aui-margin-b-15">
        <ul class="aui-list aui-list-in">
            <li class="aui-list-item" onclick="changePWD();">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title">修改密码</div>
                </div>
            </li>
            <li class="aui-list-item" onclick="applyNote();">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title">申请记录</div>
                </div>
            </li>
            <li class="aui-list-item" onclick="exportNote();">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title">导出记录</div>
                </div>
            </li>
            <li class="aui-list-item" onclick="shenhe_list();">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title">申请查看</div>
                </div>
            </li>
            <li class="aui-list-item" onclick="approve();" style="display: none;" id="approve">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title">审批列表</div>
                </div>
            </li>
            <li class="aui-list-item" onclick="logout();">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title">退出登陆</div>
                </div>
            </li>
        </ul>
    </div>


    <!-- <div class="foot-t"></div>
<ul class="foot">
  <li>
    <i class="aui-iconfont aui-icon-home"></i>
    <p>首页</p>
  </li>
  <li class="active">
    <i class="aui-iconfont aui-icon-my"></i>
    <p>我的</p>
  </li>
</ul> -->

</body>

<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript">
    function openClub() {
        var delay = 0;
        if (api.systemType != 'ios') {
            delay = 300;
        }
        api.openWin({
            name: 'club_win',
            url: './html/club_win.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    }

    function closeWin() {
        api.closeWin({});
    }

    apiready = function() {
        var data = $api.getStorage('user_data');
        // console.log(data);
        $("#p1").text($api.getStorage('dept_name'));
        $("#p2").text($api.getStorage('position_name'));
        $("#p3").text(data.date.name);

        $("#approve").show();

        // $("#headImg").attr('src', 'http://oa.big-wealth.com/Uploads/emp_pic/1.jpeg');
    }

    function logout() {
        var userid = $api.getStorage('id');
        api.ajax({
            url: 'http://oa.big-wealth.com/index.php?m=&c=public&a=logout_api',
            method: 'get',
            data: {
                values: {
                    id: userid
                },
            }
        }, function(ret, err) {
            if (ret) {
                // alert( JSON.stringify( ret ) );
                $api.setStorage('id', '');
                $api.setStorage('name', '');
                $api.setStorage('letter', '');
                $api.setStorage('position_name', ''); // 职位
                $api.setStorage('dept_name', ''); // 部门
                // 提示退出成功
                api.toast({
                    msg: '退出成功!',
                    duration: 1500,
                    location: 'bottom',
                    global: true,
                });
                api.openWin({
                    name: 'login',
                    url: './login.html',
                    pageParam: {
                        name: 'test'
                    }
                });
            } else {
                alert(JSON.stringify(err));
            }
        });

    }

    function changePWD() {
        api.openWin({
            name: 'password',
            url: './password.html',
            pageParam: {
                name: 'test'
            }
        });


        //      var id = $api.getStorage('id');
        // var url = 'http://oa.big-wealth.com/index.php?m=&c=Info&a=downApi&attach_id=MDAwMDAwMDAwMIO3nWc&api_auth_id='+id;
        // var path = '';
        // api.ajax({
        //   url: url,
        //   method: 'post',
        //   data: {
        //     values: {
        //     },
        //   }
        // },function(ret, err){
        //   if (ret) {
        //     alert(JSON.stringify(ret));
        //     path = 'http://oa.big-wealth.com/'+ret.download;
        //     api.download({
        //       url : path,
        //       // savePath : 'fs://test.png',
        //       report : true,
        //       cache : true,
        //       allowResume : true
        //     }, function(ret, err) {
        //       if (ret.state == 1) {
        //         alert(JSON.stringify(ret));
        //         // 本地路径
        //         local_path = ret.savePath;
        //         alert(local_path);
        //         // 下载成功 预览
        //         var docInteraction = api.require('docInteraction');
        //         docInteraction.open({
        //           path: local_path,
        //         }, function(ret, err) {
        //           if (err) {
        //             alert(JSON.stringify(err));
        //           } else {
        //             alert(JSON.stringify(ret));
        //           }
        //         });
        //       } else {
        //
        //       }
        //     });
        //
        //   } else {
        //     alert( JSON.stringify( err ) );
        //   }
        // });

    }

    function applyNote() {
        api.openWin({
            name: 'apply_list',
            url: './apply-list.html',
            pageParam: {
                name: 'test'
            }
        });

    }

    function exportNote() {
        api.openWin({
            name: 'export_list',
            url: './export-list.html',
            pageParam: {
                name: 'test'
            }
        });
    }

    function shenhe_list() {


        api.openWin({
            name: 'approval',
            url: './approval.html',
            pageParam: {
                name: 'test'
            }
        });

    }

    function approve() {
        api.openWin({
            name: 'approval_list',
            url: './approval_list.html',
            slidBackEnabled: false,

            pageParam: {
                name: 'test'
            }
        });

    }
</script>

</html>
